package com.tanhua.app.controller;


import com.tanhua.app.Service.PeachblossomService;
import com.tanhua.model.vo.VoiceVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RequestMapping("/peachblossom")
@RestController
public class PeachblossomController {
    @Autowired
    private PeachblossomService peachblossomService;

    // POST/peachblossom
    @PostMapping
    public ResponseEntity sendVoice(MultipartFile soundFile) throws IOException {
        peachblossomService.save(soundFile);
        return ResponseEntity.ok(null);

    }

    @GetMapping
    public ResponseEntity getVoice() {
        VoiceVo voicevo = peachblossomService.getVoice();
        return ResponseEntity.ok(voicevo);
        System.out.println("xxb");
    }
}
